package com.wuhanpe.leafid.mapper

import com.mybatisflex.core.BaseMapper
import com.wuhanpe.leafid.entity.LeafAlloc
import org.apache.ibatis.annotations.Param
import org.apache.ibatis.annotations.Update

/**
 * @author zooy
 * @since 2025/9/12-16:02
 */
interface LeafAllocMapper: BaseMapper<LeafAlloc> {

    @Update("UPDATE leaf_alloc SET max_id = max_id + step WHERE biz_tag = #{tag}")
    fun updateMaxId(@Param("tag") tag: String?): Int

    @Update("UPDATE leaf_alloc SET max_id = max_id + #{leafAlloc.step} WHERE biz_tag = #{leafAlloc.bizTag}")
    fun updateMaxIdByCustomStep(@Param("leafAlloc") leafAlloc: LeafAlloc): Int
}
